package cn.amarone.scaffold.config.business.permission;

import com.mybatisflex.core.tenant.TenantFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.LinkedHashSet;

/**
 * @author Amarone
 * @version 1.0
 * @description:
 * @date 2023/8/2 15:50
 */
@Configuration
public class TenantConfiguration {

    @Bean
    public TenantFactory tenantFactory() {
        return new TenantFactoryImpl();
    }

    public static class TenantFactoryImpl implements TenantFactory {
        @Override
        public Object[] getTenantIds() {
            LinkedHashSet result = new LinkedHashSet<Long>();
            result.add(1);
            return result.stream().toArray();
        }
    }
}
